Update tableless models to not rely on fake schema loading #17238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ticket
Part of https://community.openproject.org/projects/openproject/work_packages/57304
What are you trying to accomplish?
In Rails 7.2 the internal
attributes_to_define_after_schema_loads
method has been removed and as it was considered internal only, it is not planned to be replaced. We rely on that method to hook into the schema loading of our fakeTableless
models by manually attaching attributes and overwriting the column cache for it.We can achieve the same thing, by directly defining the attributes and completely skipping the schema loading by making
load_schema!
a no-op and manually creating a column cache.It has been extracted from #17228 as there are more things that block the upgrade to Rails 7.2, but we can already do this here to validate with all tests that the tableless models still work as intended.
Screenshots
What approach did you choose and why?
Merge checklist